package com.qiang.test1;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @package: com.qiang.test1
 * @title: SingleSafeDemoB
 * @projectName: burning
 * @description: //TODO
 * @author zhuhongqiang3
 * @date:  2020-09-07 16:22
 * @version: V1.0
 * @retrun com.qiang.test1.burning
 */
public class SingleSafeDemoB {

    public SingleSafeDemoB() {
    }

    private static class safeSingle{

        private static final SingleSafeDemoB instance = new SingleSafeDemoB();
    }

    /**
     * 当第一次加载SingleObjectLock类时并不会初始化instance,只有在第一次调用SingleObjectLock的getInstance()时Instance才会被初始化。
     * 因此第一次调用getInstance方法会导致虚拟机加载SingleHolderClass类
     */
    public static SingleSafeDemoB getInstance(){
        return safeSingle.instance;
    }

    public static void main(String[] args) {
        Map hashMap = new ConcurrentHashMap();
    }


}
